<script>
    $(document).ready(function () {
        $('.radio').change(function () {
            var id = $(this).attr('id');
            var m = $('#' + id).val().split('#');
            var key = {
                p_pregunta_id: m[0], s_seleccionada: m[1]
            };
            $.ajax({
                url: "<?= base_url('xpanel/updateSeleccion') ?>",
                type: 'POST',
                data: key,
                success: function (msg) {
                    console.log('mensaje: ' + m[0] + ' ' + m[1] );
                }
            });        
        });
    });
</script>
<!-- Content -->
<div id="content">

    <!-- Content wrapper -->
    <div class="wrapper">

        <!-- Breadcrumbs line -->
        <div class="crumbs">
            <ul id="breadcrumbs" class="breadcrumb"> 
                <li><a href="<?= base_url('xpanel') ?>">XPANEL</a></li>
            </ul>

        </div>
        <!-- /breadcrumbs line -->

        <!-- Page header -->
        <div class="page-header">
            <div class="page-title">
                <h5></h5>
            </div>
        </div>
        <!-- /page header -->

        <!-- Default wizard -->
        <div class="widget">
            <div class="navbar">
                <div class="navbar-inner">
                    <h6>Exámen</h6>
                </div>
            </div>
            
            <form id="wizar" method="post" action="<?= base_url('xpanel/c') ?>" class="form-horizontal row-fluid well">
                <?php foreach($PregConOpciones as $p_pregunta_id => $datos){?>
                <div class="control-group">
                    <label class="span12" style="text-align:justify"><?= $datos['pregunta'] ?></label>
                    <label class="checkbox inline">  
                        <?php foreach ($datos['opciones'] as $op) { ?>
                            <label ><input class="radio" type="radio" name="nm<?= $op->p_pregunta_id ?>" id="op<?= $op->p_pregunta_id."-".$op->o_matricula ?>" value="<?=$op->p_pregunta_id.'#'.$op->o_matricula?>" class="styled"><?= $op->o_opcion ?></label>
                        <?php } ?>
                    </label>
                </div>
                <?php } ?>
                <div>
                    <div class="form-actions align-right">
                        <button type="submit" class="btn btn-danger">Submit</button>
                    </div>
                </div>
            </form>            
        </div>

    </div>
    <!-- /content wrapper -->

</div>
<!-- /content -->